<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="js/jquery.cookie.js"></script>
<script type="text/javascript">

$(document).ready(function() {
	$("#loginUser")[0].value = $.cookie("userID");
	$.ajax({
		type : "post",
		url : "GetWorkList",
		data : $("#q_form").serializeArray(),
		dataType : "JSON",
		success : function(workListResult) {
			var preTypeSN = 999;
			$.each(workListResult, function(i, res) {
				var typeSN = res.typeSN;
				
				if (preTypeSN != typeSN) {
				 	if (preTypeSN != 999){
						$("#nav").append("</li>");
					}
					/** 主要的功能別 **/
					$("#nav").append("<li><a href=\"#\">"+res.typeName+"</a><ul id=\""+typeSN+"\"></ul>");
				}
				
				/** 功能細項 **/
				$("#"+typeSN).append("<li><a href=\""+res.webUrl+"\" target=\"bottomFrame\">"+res.itemName+"</a></li>");
				preTypeSN = typeSN;				
			});
			
			$(" #nav ul ").css({display: "none"}); // Opera Fix
			$(" #nav li").hover(function(){
					$(this).find('ul:first').css({visibility: "visible",display: "none"}).show(400);
					},function(){
					$(this).find('ul:first').css({visibility: "hidden"});
					});
			
			var mesStr= "登入人員：" + $.cookie("userName") +" ("+$.cookie("userID")+")<br/>";
			var roleArry = $.cookie("roleList").split("||");
			mesStr += "所屬角色：";
			for(var l=0;l<roleArry.length;l++){
				mesStr += roleArry[l];
				if (l != (roleArry.length-1) ) {
					mesStr += ",";	
				}
			}
			$("#mes").html(mesStr);
			
		}, error : function(xhr, ajaxOptions, thrownError) {
			$("#errorMessage").html("錯誤訊息狀態：" + xhr.status+"<p>");
			$("#errorMessage").append(xhr.responseText);
		}
	});
});
</script>


</head>

<body>

<div id="outer2">
	<div id="sidebar2">
	<ul id="nav"></ul>
	</div>
	<div id="loginInfo">
		<div id="mes"></div>
	</div>
</div>
<form id="q_form" method="post">
	<input type="hidden" id="loginUser" name="loginUser" />					<!-- 目前登入的使用者 -->
</form>

	
	
</html>
</body>


